﻿/// <reference path="_namespace.js" />

/*****************************************************************************
Ajax library class definition. Kevin Robinson 2008.
Class: ajax.xna.RayCasterMap
/*****************************************************************************/

$addNamespace("ajax.xna");
$imports("ajax.xna.SimpleSprite");

ajax.xna.RayCasterMap = function()
{
    this.initialize();
}

ajax.xna.RayCasterMap.prototype = 
{
    blocks: [],
    colours: [],
    sprites: []
}

ajax.xna.RayCasterMap.prototype.initialize = function()
{
    this.blocks =    
    [
      [8,8,8,8,8,8,8,8,8,8,8,4,4,6,4,4,6,4,6,4,4,4,6,4],
      [8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,4],
      [8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,6],
      [8,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6],
      [8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,4],
      [8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,6,6,6,0,6,4,6],
      [8,8,8,8,0,8,8,8,8,8,8,4,4,4,4,4,4,6,0,0,0,0,0,6],
      [7,7,7,7,0,7,7,7,7,0,8,0,8,0,8,0,8,4,0,4,0,6,0,6],
      [7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,6,0,0,0,0,0,6],
      [7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,4],
      [7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,6,0,6,0,6],
      [7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,0,4,6,0,6,6,6],
      [7,7,7,7,0,7,7,7,7,8,8,4,0,6,8,4,8,0,3,3,0,3,3,3],
      [2,2,2,2,0,2,2,2,2,4,6,4,0,0,6,0,6,0,3,0,0,0,0,3],
      [2,2,0,0,0,0,0,2,2,4,0,0,0,0,0,0,3,0,3,0,0,0,0,3],
      [2,0,0,0,0,0,0,0,2,4,0,0,0,0,0,0,4,0,3,0,0,0,0,3],
      [1,0,0,0,0,0,0,0,1,4,4,4,4,4,6,0,0,0,3,0,0,0,3,3],
      [2,0,0,0,0,0,0,0,2,2,2,1,2,2,2,6,6,0,3,5,0,5,0,5],
      [2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5],
      [2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5],
      [1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5],
      [2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5],
      [2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5],
      [2,2,2,2,1,2,2,2,2,2,2,1,2,2,2,5,5,5,5,5,5,5,5,5]

    ];
    var Sprite = ajax.xna.SimpleSprite;
    this.sprites = 
    [
      new Sprite(20.5, 11.5, 10), //green light in front of playerstart
      //green lights in every room
      new Sprite(18.5,4.5, 10),
      new Sprite(10.0,4.5, 10),
      new Sprite(10.0,12.5,10),
      new Sprite(3.5, 6.5, 10),
      new Sprite(3.5, 20.5,10),
      new Sprite(3.5, 14.5,10),
      new Sprite(14.5,20.5,10),
      
      //row of pillars in front of wall: fisheye test
      new Sprite(18.5, 10.5, 9),
      new Sprite(18.5, 11.5, 9),
      new Sprite(18.5, 12.5, 9),
      
      //some barrels around the map
      new Sprite(21.5, 1.5, 8),
      new Sprite(15.5, 1.5, 8),
      new Sprite(16.0, 1.8, 8),
      new Sprite(16.2, 1.2, 8),
      new Sprite(3.5,  2.5, 8),
      new Sprite(9.5, 15.5, 8),
      new Sprite(10.0, 15.1,8),
      new Sprite(10.5, 15.8,8)
    ];

    
    this.colours = 
    [
        new ajax.drawing.Colour(255, 0, 0),
        new ajax.drawing.Colour(0, 255, 0),
        new ajax.drawing.Colour(0, 0, 255),
        new ajax.drawing.Colour(255, 255, 255),
        new ajax.drawing.Colour(255, 255, 0),
        new ajax.drawing.Colour(0, 255, 255),
        new ajax.drawing.Colour(255, 0, 0),
        new ajax.drawing.Colour(0, 255, 0),
        new ajax.drawing.Colour(0, 0, 255),
        new ajax.drawing.Colour(255, 255, 255),
        new ajax.drawing.Colour(255, 255, 0),
        new ajax.drawing.Colour(0, 255, 255)
    ]
}

